
<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <div class="hei10"></div>
          <div class="where" style="background: #fff; padding: 10px 30px; font-size: 14px; color: #595959;">当前位置：分销后台><router-link to="/finance/finance">返利报表</router-link></div>
          <div class="hei10"></div>
          
          
                <div class="powertop">
						<router-link class="powertopli powertopact" to="/finance/finance">返利报表</router-link>
						<router-link class="powertopli" to="/finance/financenumber">返利号码</router-link>
				</div>
                <div class="con">
                    <div class="conleft">
                        <div class="flex">
                            <div class="gong">本月共计发放积分：50000</div>
                            <div class="gong">本月共计充值：30000</div>
                        </div>
                        <div class="flex">
                            <div class="gong">符合返利要求用户数：500</div>
                            <div class="gong">领取用户数：500</div>
                        </div>
                    </div>
                    <div class="conright">
                        <el-date-picker v-model="month" type="month" placeholder="选择月份"> </el-date-picker>
                    </div>
                </div>
                <div class="conlist">
                    <div class="flex">
                        <div class="gong">
                            <el-input v-model="form.source" placeholder="请输入商品名称"></el-input> 
                            <el-button type="danger" @click="search">检索</el-button>
                        </div>
                        <div class="gong"><el-button type="danger" @click="search">导出返利明细</el-button></div>
                    </div>
                    <div class="list">
                        <div class="th">商品名称</div>
                        <div class="th">商品编码</div>
                        <div class="th">发货用户数</div>
                        <div class="th">激活用户数</div>
                        <div class="th">已领取积分</div>
                        <div class="th">已充值金额</div>
                        <div class="th">操作</div>
                    </div>
                    <div class="list" v-for="item in list" :key="item.id">
                        <div class="td">{{item.mobile}}</div>
                        <div class="td">{{item.month}}</div>
                        <div class="td">{{item.cycle}}</div>
                        <div class="td">{{item.rebate_amount}}</div>
                        <div class="td">{{item.id}}</div>
                        <div class="td" v-if="item.status == 0">{{item.status}}</div>
                        <div class="td" v-if="item.status == 100">{{item.status}}</div>
                        <div class="td" v-if="item.status == 200">{{item.status}}</div>
                        <div class="td td2">
                            <el-button type="text">修改时间</el-button>
                            <el-button type="text">暂停领取</el-button>
                            <el-button type="text">统计</el-button>
                        </div>
                    </div>
                    <el-pagination background layout="total,prev, pager, next" :current-page="page" @current-change="fanye" :page-size="pagesize" :total="total"></el-pagination>
                </div>
            </div>
        </div>
        
        <!-- <foot></foot> -->
    </div>

</template>

<script>
    import axios from 'axios'
    import top from '@/components/top.vue'
    import left from '@/components/left.vue'
    import foot from '@/components/foot.vue'
    import QRcode from '@xkeshi/vue-qrcode';
    import moment from "moment";
    export default {
        components: {
            "left": left,
            "top": top,
            "foot": foot,
            qrcode : QRcode
        },
        name: "finance",
        data() {
            return {
                month:"",
                total:0,
                pagesize:20,
                page:1,
                list:"",
                loading:false,
                form:{},
               
            }
        },
        created() {
            var shop = JSON.parse(localStorage.getItem('SHOP'));
            this.shopname = shop.shop_name
            var that = this
           
            this.month = moment().format("YYYY-MM");
            console.log(moment().format("YYYY-MM"))
        },
        mounted() {
   
        },
        methods: {
            search:function(){
                this.getlist()
            },
            //翻页
            fanye:function(page){
            	this.loading = true
            	this.page = page
            	this.getlist()
            },
            //获取列表
            getlist:function(){
                var that = this
                if(this.month == null){
                    this.month = ''
                }
                axios.get('/api/plan-market/rebate/list?page='+this.page+'&page_size='+this.pagesize+'&month='+this.monthsearch+'&mobile='+this.mobile+'&sku='+this.sku)
                	.then(response => {
                		if(response.data.msg.code == 0){
                            that.list = response.data.data.data
                            that.total = response.data.data.total
                            that.loading = false
                		}else{
                			that.$message.error(response.data.msg.info);
                		}
                	})
            },
        }
    }
</script>

<style lang="scss" scoped>
    .index{
    	
        .moneylist{ display: flex;}
        .erimg{ width: 200px;}
        .red{ border: 1px #FF3B3B solid !important; color: #FF3B3B !important;}
        .moneylist div{ border: 1px #AAAAAA solid; width: 85px; height: 35px; line-height: 35px; text-align: center; margin-right: 10px; cursor: pointer;}
    	
                .title{border-bottom: 1px #EAEAEA solid;  line-height: 45px; padding-left: 30px; font-size: 16px; background: #F9F9F9; color: #727272}
                
            
            .powertop{ display: flex; background:#f9f9f9; }
            .powertopli{ flex-basis: 160px; line-height: 45px; border-top: 4px #EBECEF solid; color: #727272; border-right: 1px #EAEAEA solid; font-size: 14px; text-align: center;}
            .powertopact{ background: #FFFFFF; border-top: 4px #DD2727 solid;}
            .con{  background: #FFFFFF; padding: 30px 40px; display: flex; justify-content: space-between;
                .conleft{
                    .flex{ display: flex; margin-bottom: 20px;}
                    .gong{ margin-right: 30px; color: #333}
                }
                .conright{
                    .el-input__inner{ line-height: 40px !important; height: 40px !important;}
                }
            }
            .conlist{ padding: 30px; background: #FFFFFF;
                .flex{ display: flex; justify-content: space-between}
                .gong{ display: flex;
                    .el-input__inner{ width: 250px;}
                    .el-button--danger{ margin-left: 20px;}
                }
                .list{ display: flex; margin-top: 20px; border-bottom: 1px #eaeaea solid;
                    .th{ background: #EAEAEA; text-align: center; flex: 1; padding: 15px 0; font-size: 14px;}
                    .td{ background: #ffffff; text-align: center; flex: 1; padding: 15px 0; font-size: 14px;}
                }
            }
    	
    }
</style>
